<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Controller.php 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */

class Sitealbum_Widget_FeaturedPhotosCarouselController extends Engine_Content_Widget_Abstract {

  public function indexAction() {
    // Total List List Sponserd
    $totalFeaturedPhotos = Engine_Api::_()->sitealbum()->getFeaturedPhotos();
    // Total Count Sponsored Classiifed
    $this->view->totalCount = $totalCount = $totalFeaturedPhotos->count();
		$featuredPhotoCarousel = Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.featuredalbum', null);
    if (!($this->view->totalCount > 0) || empty($featuredPhotoCarousel)) {
      return $this->setNoRender();
    }

    $this->view->inOneRow = $inOneRow = $this->_getParam('inOneRow', 3);
    $this->view->noOfRow = $noOfRow = $this->_getParam('noOfRow', 2);
    $this->view->totalItemShow = $totalItemShow = $inOneRow * $noOfRow;
    // List List featured
    $this->view->featuredPhotos = $featuredPhotos = Engine_Api::_()->sitealbum()->getFeaturedPhotos(array('limit' => $totalItemShow));

    // CAROUSEL SETTINGS  
    $this->view->interval = $interval = $this->_getParam('interval', 250);
    $this->view->count = $count = $featuredPhotos->count();
    $this->view->heightRow = @ceil($count / $inOneRow);
    $this->view->vertical = $this->_getParam('vertical', 0);
    $this->view->showLightBox = Engine_Api::_()->sitealbum()->showLightBoxPhoto();
    if ($this->view->showLightBox) {
      $this->view->params = $params = array('type' => 'featured', 'count' => $totalCount,'title'=>$this->_getParam('title', 'Featured Photos'));
    }
  }

}